﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lilium.T4.Hosting
{
    public abstract class CustomDirectiveProcessorBase : ICustomDirectiveProcessor
    {
        public abstract void ProcessDirective(IDictionary<string, string> arguments);

        protected string GetRequiredArgument(IDictionary<string, string> arguments, string name)
        {
            if (arguments == null) throw new ArgumentNullException("name");

            string value;
            if (arguments.TryGetValue(name, out value))
                return value;
            else
                throw new InvalidOperationException(string.Format("Missing required argument {0}", name));
        }
    }
}
